import { axios } from '@/utils/request'
import { METHOD } from '@/store/mutation-types'
// post
export function postAction(url, parameter, config) {
  return axios({
    url: url,
    method: METHOD.POST,
    data: parameter,
    ...config
  })
}

export function putAction(url, parameter, config) {
  return axios({
    url: url,
    method: METHOD.PUT,
    data: parameter,
    ...config
  })
}

export function getAction(url, parameter, config) {
  return axios({
    url: url,
    method: METHOD.GET,
    params: parameter,
    ...config
  })
}

export function deleteAction(url, parameter, config) {
  return axios({
    url: url,
    method: METHOD.DELETE,
    params: parameter,
    ...config
  })
}

// post method= {post | put}
export function httpAction(url, parameter, method, config) {
  return axios({
    url: url,
    method: method,
    data: parameter,
    ...config
  })
}
